import * as YvanUI from "yvan-ui-wotu"

const React = YvanUI.React
const _ = YvanUI.lodash

interface Ref {
    grid1: YvanUI.Grid
}

export default class GridLoading extends YvanUI.Scope<void, Ref> {

    main = this.$$({
        check1: ''
    })

    onRender(){
        this.watch(()=>this.main.check1,
            (v)=> {
                this.refs.grid1.loading = (v === '1')
            });
    }

    vjson = this.$$({
        view: 'page',
        title: 'GridLoading',
        items: [
            {
                view: 'card',
                items: [
                    {
                        view: 'form',
                        items: [
                            {
                                view: 'switch',
                                label: '勾选1',
                                bind: 'main.check1'
                            }
                        ]
                    },
                ]
            },
            {
                view: 'card',
                items: [
                    {
                        view: 'grid',
                        title: 'GridLoading',
                        ref: 'grid1'
                    }
                ]
            }
        ]
    })
}